package com.pattern.Iterator;

public class Main {

    public static void main(String[] args) {
        Book book1 = new Book("A图解设计模式");
        Book book2 = new Book("BJAVA三十六讲");
        Book book3 = new Book("Cc++ primer");
        Book book4 = new Book("D编译原理");

        BookShelf shelf = new BookShelf(10);
        shelf.append(book1);
        shelf.append(book2);
        shelf.append(book3);
        shelf.append(book4);

        Iterator iterator = shelf.iterator();
        while (iterator.hasNext()) {
            Book book = (Book) iterator.next();
            System.out.println(book.getBookName());
        }

    }

}
